<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
       //forEach
       /*
       接收函数，该函数第一个形参代表每一位的数据，
                        第二个形参代表每一位的序号，
                        第三个形参代表原数组
       */

       let a = [4,5,6];
       a.forEach(function(x,y,z) {
           console.log(x,y,z);
       });


       for (let i=0;i<a.length;i++) {
            (function(x,y,z){
                console.log(x,y,z);
            })(a[i],i,a);
       }
    
    </script>
</body>
</html>